package com.nondo.rdp.finance.service.impl.setting.home;

import com.nondo.rdp.finance.domain.setting.home.SettingModuleSlide;
import com.nondo.rdp.finance.repository.setting.home.SettingModuleSlideRepository;
import com.nondo.rdp.finance.service.setting.home.SettingModuleSlideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class SettingModuleSlideServiceImpl implements SettingModuleSlideService {
    @Autowired
    SettingModuleSlideRepository settingModuleSlideRepository;

    @Override
    public SettingModuleSlide findOne(Long id) {
        return this.settingModuleSlideRepository.findOne(id);
    }

    @Override
    public SettingModuleSlide save(SettingModuleSlide settingModuleSlide) {
        return this.settingModuleSlideRepository.save(settingModuleSlide);
    }

    @Override
    public void update(SettingModuleSlide settingModuleSlide) {
        this.settingModuleSlideRepository.save(settingModuleSlide);
    }

    @Override
    public void delete(Long id) {
        this.settingModuleSlideRepository.deleteById(id);
    }

    @Override
    public List<SettingModuleSlide> findAll(Sort sort) {
        return this.settingModuleSlideRepository.findAllByDelFlag("0", sort);
    }
}